package org.epidroid.epidroid.chronos.engine.objects;

import java.util.Date;
import java.util.List;

import org.epidroid.epidroid.chronos.engine.Chronos;
import org.epidroid.epidroid.chronos.engine.utils.ChronosUtils;

import android.util.Log;

public class ChronosDay implements Printable {

	private String _id = null;
	private String _dateString = null;
	private Date _date = null;
	private List<ChronosCourse> _courses = null;
	private ChronosWeek _week = null;

	public ChronosDay(String id, String date) {
		_id = id;
		_dateString = date;
		_date = ChronosUtils.parseDate(date);
	}

	public ChronosWeek getWeek() {
		if (_week == null) {
			Log.e(Chronos.LOGCAT, "Unreached");
			return null;
		}
		return _week;
	}

	public String getId() {
		return _id;
	}

	public String getDateString() {
		return _dateString;
	}

	public Date getDate() {
		return _date;
	}

	public void setCourses(List<ChronosCourse> courses) {
		_courses = courses;
	}

	public List<ChronosCourse> getCourses() {
		return _courses;
	}

	public void print(Integer indent) {
		ChronosUtils.printWithIndent(indent, "Day:");
		indent += 4;
		ChronosUtils.printWithIndent(indent, "id: " + _id);
		ChronosUtils.printWithIndent(indent, "date: " + _dateString);
		for (ChronosCourse course : _courses) {
			course.print(indent);
		}
	}

	public void setWeek(ChronosWeek week) {
		_week = week;
	}

}
